#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
using std::ifstream;
using std::string;
using std::istringstream;

class Test{
public:
    static Test * getInstance(){
        if(pInstance){
            return pInstance;
        }else{
            pInstance =new Test();
            return pInstance;
        }
    }
    void configfile(){
        ifstream ifs("1.txt");
        if(!ifs.is_open()){
            return ;
        }
        string line;
        string key,value;
        while(getline(ifs,line)){
            istringstream iss(line);
            iss>>key>>value;
            cout<<key<<"    "<<value<<endl;
        }
    }

    static void destory(){
        if(pInstance){
            delete pInstance;
            pInstance=nullptr;
        }
    }
private:
    Test(){}
    ~Test(){}
    static Test* pInstance;
};
Test * Test::pInstance=nullptr;
void test(){
    Test * pInstance=Test::getInstance();
    pInstance->configfile();
    Test * pInstance2=Test::getInstance();
    pInstance2->configfile();
}
int main(int argc, char * argv[]){
    test();
    return 0;
}

